<!DOCTYPE html>
<html>
<head>
 <title>小学生口算系统</title>
 <h1 align="center" ><font  color="#4169E1">小学生口算系统(学生)</font></h1>
</head>
<body>
<script>
var ff 
function show()
{
    var reader = new FileReader();
    reader.onload = function() 
    {
        //alert(this.result)
        story.value=this.result        
    }
    var f = document.getElementById("filePicker").files[0];   
    ff=f.name;
    //alert(f.name)
    reader.readAsText(f);
}

 
function download(){ 
    var text = document.getElementById("story").value; 
    var blob = new Blob([text], { type: "text/plain"}); 
    var anchor = document.createElement("a"); 
    //anchor.download = "my-filename.txt"; 
    anchor.download = ff;
    anchor.href = window.URL.createObjectURL(blob); 
    anchor.target ="_blank"; 
    anchor.style.display = "none"; // just to be safe! 
    document.body.appendChild(anchor); 
    anchor.click(); 
    document.body.removeChild(anchor); 
}
</script>
<div align="center">  
<input type="file" name="file" id="filePicker" onchange="show()"  />
<br>
 
<textarea id="story" name="story" rows="15" cols="60">
</textarea>
<br>
<button type="button" onclick="download()">打印</button> 
<a href="answer.txt">点击查看答案</a>
</div>
</body>
</html>